<template>
  <view class="pdfViewer">
    <web-view :src="url1"></web-view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      url1: "",
      src: "",
      viewerUrl: "/hybrid/html/web/viewer.html?file=",
    };
  },
  methods: {},
  onLoad(options) {
    if (ZWJSBridge) {
      ZWJSBridge.setTitle({
        title: "预览pdf",
      })
        .then((res) => {})
        .catch((err) => {});
    }
    if(options.src){
      this.url1 = this.viewerUrl +encodeURIComponent(`https://nfzjszlb.jst.zj.gov.cn/eca/fwjd/PrintServer/api/PreviewWordRpt?groupGuid=%7BFA599DFB-ED68-4AC4-861E-46BD947B79CE%7D&toRowGuid=${options.src}&token=${uni.getStorageSync('token')}&dataGuid=268f75e9-4b83-4b34-9ef8-88add3979663&_=1661926980110`);
    } else{
      this.url1 = this.viewerUrl + encodeURIComponent(`https://nfzjszlb.jst.zj.gov.cn/eca/fwjd/FileServer/api/Preview?fileGuid=${uni.getStorageSync('fileurl')}&token=${uni.getStorageSync('token')}`)
    }
    console.log(this.url1,'xiaohe')
  },
};
</script>

<style>
.pdfViewer {
  width: 100%;
  height: 100vh;
}
</style>
